<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="root">
        <!-- @keyup.queren 只有按下enter键才会触发该事件 -->
        <!-- <input type="text" @keyup.queren="fn"> -->
        <!-- <input type="text" @keydown.tab="fn"> -->
        <!-- 只有按下ctrl键和y键，才会触发该事件 -->
        <input type="text" @keyup.ctrl.y="fn">
    </div>
    <script>
        Vue.config.productionTip = false;
        // 设置回车键的别名为 queren
        Vue.config.keyCodes.queren = 13;

        let vm = new Vue({
            el: '#root',
            data: {},
            methods: {
                fn(e){
                    // 输出表单里的值
                    console.log(e.target.value);
                }
            },
        });
    </script>
</body>

</html>